Additional common tasks with WorkZone I/O Manager

Create new modifiers (via HTTP request)

You can create request templates, using the HTTP modifier.

  1. In the Developer app, on the navigation panel under Servers (top left corner of the screen), click your web server name.
  2. Click Modules (on the bottom left side).
  3. Right-click the blank space in the center of the screen, and select Add > Input > HTTP.
  4. Configure properties of your request:
    • General tab: provide Name.
    • Connection tab:
      • Protocol: select http.
      • Verb: should be equal to the request method
      • Host: provide hostname (in the example below, it is db01.lmdom.local)
      • Timeout: can be set as default
      • Remote path: can be left blank
      • Filename: should be partial path combined with the hostname (in our example, it is OData\WzpSystemDispatchers(‘2’))
      • Connection string: provide string used for ntlm authentication (on the example below, it is https://username:password@db01.lmdom.local/OData/WzpSystemDispatchers(‘2’))

    • Authentication tab: provide username, password and domain information.
    • Response tab: select JobData.
  5. Now you can add your HTTP modifier to the Pass-Through task. Double-click on the Pass-Through task, select the Enter modifiers tab and click Add. The Choose modifier dialog box will be displayed.
  6. Specify the following details:
    • General tab: Select your HTTP modifier from the Name droplist.
    • Run on tab:
      • Under Run the modifier on, select JobInfo, and enter GetData as name.
      • Under Modifier result in, select JobInfo and enter GetDataResult as name.

Create new modifiers (via scripts)

You can also add scripts to manage your requests and responses.

  1. In the Developer app, on the navigation panel, select Scripts (bottom left corner of the screen).
  2. Right-click the blank space in the center of the screen, and select Add.
  3. Enter the name of your script, and click OK.
  4. Select your created script (on the left pane), and click Edit.
  5. Add the needed JavaScript code inside the script, and click Save.

    Tip: Click Test to check that your code is correct and can be compiled.

  6. You can also add your script to the Pass-Through task:
    1. In the Developer app, on the navigation panel under Servers (top left corner of the screen), click your web server name.
    2. Click Modules (on the bottom left side).
    3. Double-click your Pass-Through task, then select Enter Modifiers > Add.
    4. Under Type, select Script, and select your script's name. Now you can open and edit your script as needed.
    5. For HTTP modifier, which uses GetData and GetDataresult JobInfos, you can use the following script:

      It will send the request with empty GetData and try to take response data from GetDataResult:

      var fieldValue = job.getJobInfo("GetDataResult", i);

      Then it will try to find specific value from the response data:

      var fullValue = fieldValue.match("Description>(.*)</d:Description");

      var value = fullValue[1];

      If found, it will be send to UpdateData JobInfo using code:

      var fieldValue2 = job.getJobInfo("UpdateData", 0);

      var value2 = fieldValue2.replace("LocalPrint19", value);

      job.setJobInfo("UpdateData", value2);

      And in the end the script will also verify if the data is present:

      var fieldValue3 = job.getJobInfo("UpdateData", 0);

      logger.logEvent(400, "Updated: "+fieldValue3);

      All infos will be saved to your logs (on the Monitor tab).

    6. On the Enter Modifier tab, place your script to be triggered as a second subtask.
    7. Optionally, you can add a third subtask such as HTTP modifier, which will use updated UpdateData JobInfo as a default body and can be used for external API.
    8. Click Ok.

Save changes (create a commit)

  1. To save your changes, click Commit. A new window will appear with the list of all your changes.

  2. Optionally, enter the commit info message.

  3. Click OK to save the selected changes in your setup.
  4. Under http://localhost:3479/Deployment, click on your web server instance to see all of your changes.
  5. To deploy only specific changes, click Deploy next to this commit (their state will change to Active then).

Start a workflow

Once your changes are saved and workflow is ready, you can start web server by the request in Powershell:

Invoke-WebRequest -Uri http://(ifLocalhostPleaseUseComputerName):8082/webinputport/WebServer1/ -Method POST

The web server will be started and will trigger the Pass-Through task. Now you can navigate to the Monitor application.

Here you can check if the web server is started and if there are any errors or warnings.

On the screenshot above, the Pass-Through gets request as one of its sub tasks, but the https://db01.lmdom.local:443/OData/WzpSystemDispatchers/... webpage is not responding.

You can also see here output and other information for your Script sub task.

Important:

Your license must be valid. Otherwise you will not be able to start the web server via a Powershell request. You can check your license via Lasernet > License Manager, or Lasernet > Lasernet Monitor > Licensing.

Add a scheduler

If you want to repeat the Pass-Through tasks after some intervals, you can do that by configuring a scheduler.

  1. Select the Pass-Through task > Scheduling > Add > General.
  2. Enable the Re-schedule option to repeat the task all the time.
  3. Select the Times tab, and click Add.
  4. Specify how often to repeat the task. For example, start every hour and repeat every 10 minutes.

  5. Save and commit your changes.

Important: Remember to restart the service after each commit.

Deploy your changes on localhost:3479/Deployment/Details/OurServerName page and then trigger the web server as described in Start a workflow.

See also:

Set up and configure WorkZone I/O Manager